<%-- 
    Document   : updateHospital
    Created on : 4 Jan, 1980, 4:39:02 PM
    Author     : sagar
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<link type="text/css" href="css/main.css" rel="stylesheet" />
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<%@include file="../common/script.jsp" %>
<script type="text/javascript" src="../js/googleMap.js" ></script>
<!DOCTYPE html>
<script type="text/javascript">
    var rules=new Array();
    rules[0]='address|required|Please Enter Hospital Address';
    rules[1]='hospitalName|required|Please Enter Hospital Name';
    rules[2]='level|required|Please Enter Level';
    rules[3]='zoneId|required|Please Select Zone';
    rules[4]='bedDesc|required|Please Enter Bed Desc';
    rules[5]='tieUpStage|required|Please Enter Tie Up Stage';
    rules[6]='ipd|required|Please Enter IPD';
    rules[7]='opd|required|Please Enter OPD';
    rules[8]='dayCare|required|Please Enter DayCare';
    rules[9]='diagnostics|required|Please Enter Diagnostics';
    rules[10]='ambulanceService|required|Please select ambulance service';
    rules[11]='contact1|required|Please Enter contact1';
    //rules[12]='contact2|required|Please Enter contact2';
    //rules[13]='contact3|required|Please Enter contact3';
    //rules[14]='speciality|required|Please Enter Hospital Speciality';
    rules[12]='opd|custom|CheckDecimalOpd()';
    rules[13]='ipd|custom|CheckDecimalIpd()';
    rules[14]='dayCare|custom|CheckDecimalDayCare()';
    rules[15]='diagnostics|custom|CheckDecimalDiagnostics()';
    rules[16]='level|numeric|Please Enter only numeric';
    rules[17]='tieUpStage|numrange|1-3|Please Enter Tie Up Stage between 1, 2 and 3';  

    function CheckDecimalOpd()
    { 
        var decimal=  /^[0]+(\.[0-9]+)+$/;
        if(document.getElementById("opd").value.match(decimal)) 
        { 
            return null;
        }
        else
        { 
            return 'Please enter decimal no';
        }
    }     
    
    function CheckDecimalIpd()
    { 
        var decimal=  /^[0]+(\.[0-9]+)+$/;
        if(document.getElementById("ipd").value.match(decimal)) 
        { 
            return null;
        }
        else
        { 
            return 'Please enter decimal no';
        }
    }     
    
    function CheckDecimalDayCare()
    { 
        var decimal=  /^[0]+(\.[0-9]+)+$/;
        if(document.getElementById("dayCare").value.match(decimal)) 
        { 
            return null;
        }
        else
        { 
            return 'Please enter decimal no';
        }
    }     
    
    function CheckDecimalDiagnostics()
    { 
        var decimal=  /^[0]+(\.[0-9]+)+$/;
        if(document.getElementById("diagnostics").value.match(decimal)) 
        { 
            return null;
        }
        else
        { 
            return 'Please enter decimal no';
        }
    }     
    
               
</script>
<script type="text/javascript">
    function getLatLog(){
        var location = new google.maps.LatLng(${hospital.latitude}, ${hospital.longitude});      
        marker.setPosition(location);             
        map.setCenter(location);
    }
</script>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <%@include file="../common/title.jsp" %>
    </head>
    <body onLoad="yav.init('form1',rules,'inline');getLatLog();">
        <%@include file="../common/header.jsp" %>
        <%@include file="../common/menu.jsp" %>
        <div style="width: 40%;  position: absolute; top:150px; left:20px; font:normal 12px/normal Arial;">
            <%@include file="../common/message.jsp" %>
            <form:form id="form1" name="form1" modelAttribute="hospital"  method="POST">
                <fieldset>
                    <legend><spring:message code="title.updateHospital"/></legend>
                    <table class="formTable" >
                        <tr>
                            <td><spring:message code="hospitalAddress"/>:<br/>
                                <form:textarea path="hospitalAddress" id="address" type="text" style="clear:both;" />
                                <br/><span id="errorsDiv_address"></span></td>
                            <td><spring:message code="hospitalName"/>:<br/>
                                <form:input path="hospitalName" id="hospitalName" cssClass="userInputLarge"/>
                                <br/><span id="errorsDiv_hospitalName"></span></td>
                        </tr>
                        <tr style="display:none;">
                            <td>Latitude:<br/>
                                <form:input path="latitude" id="latitude" type="text" cssClass="userInputLarge"/><br/>

                            <td>Longitude:<br/>
                                <form:input path="longitude" id="longitude" type="text" cssClass="userInputLarge"/></td>
                        </tr>

                        <tr>
                            <td><spring:message code="level"/>:<br/>
                                <form:input path="level" id="level" cssClass="userInputMedium"/>
                                <br/><span id="errorsDiv_level"></span></td>

                            <td><spring:message code="selectZone"/>:<br/>
                                <form:select  path="zoneId.zoneId" id="zoneId" style="margin-bottom: 5px">
                                    <form:option value="" label="-"></form:option>
                                    <form:options items="${zoneList}" itemLabel="zoneName" itemValue="zoneId" cssClass="userInputMedium"></form:options>
                                </form:select>
                                <br/><span id="errorsDiv_zoneId"></span>
                            </td>
                        </tr>

                        <tr>
                            <td><spring:message code="bedDesc"/>:<br/>
                                <form:input path="bedDesc" id="bedDesc" cssClass="userInputMedium"/>
                                <br/><span id="errorsDiv_bedDesc"></span></td>
                            <td><spring:message code="tieUpStage"/>:<br/>
                                <form:input path="tieUpStage" id="tieUpStage" cssClass="userInputMedium"/>
                                <br/><span id="errorsDiv_tieUpStage"></span></td>
                        </tr>
                        <tr>
                            <td><spring:message code="ipd"/>:<br/>
                                <form:input path="ipd" id="ipd" cssClass="userInputMedium"/>
                                <br/><span id="errorsDiv_ipd"></span></td>
                            <td><spring:message code="opd"/>:<br/>
                                <form:input path="opd" id="opd" cssClass="userInputMedium"/>
                                <br/><span id="errorsDiv_opd"></span></td>
                        </tr>
                        <tr>
                            <td><spring:message code="dayCare"/>:<br/>
                                <form:input path="dayCare" id="dayCare" cssClass="userInputMedium"/>
                                <br/><span id="errorsDiv_dayCare"></span></td>
                            <td><spring:message code="diagnostics"/>:<br/>
                                <form:input path="diagnostics" id="diagnostics" cssClass="userInputMedium"/>
                                <br/><span id="errorsDiv_diagnostics"></span></td>
                        </tr>
                        <tr>
                            <td><spring:message code="ambulanceService"/>:<br/>
                                <form:input path="ambulanceService" id="ambulanceService" cssClass="userInputLarge"/>
                                <br/><span id="errorsDiv_ambulanceService"></span></td>

                            <td><spring:message code="contact1"/>:<br/>
                                <form:input path="contact1" id="contact1" cssClass="userInputLarge"/>
                                <br/><span id="errorsDiv_contact1"></span></td>
                        </tr>
                        <tr>
                            <td><spring:message code="contact2"/>:<br/>
                                <form:input path="contact2" id="contact2" cssClass="userInputLarge"/>
                                <br/><span id="errorsDiv_contact2"></span></td>
                            <td><spring:message code="contact3"/>:<br/>
                                <form:input path="contact3" id="contact3" cssClass="userInputLarge"/><br/>
                                <span id="errorsDiv_contact3"></span><br/></td>
                        </tr>
                        <tr>
                            <td><spring:message code="speciality"/>:<br/>
                                <form:input path="speciality" id="speciality" cssClass="userInputLarge"/><br/>
                                <span id="errorsDiv_speciality"></span><br/></td>
                            <td><spring:message code="insurance"/>:<br/>
                                <spring:message code="yes"/> <form:radiobutton path="isInsurance" value="true"/>&nbsp;&nbsp;&nbsp;
                                <spring:message code="no"/> <form:radiobutton path="isInsurance" value="false"/></td>
                        </tr>
                        <tr>
                            <td><spring:message code="depositLess"/>:<br/>
                                <spring:message code="yes"/> <form:radiobutton path="depositLess" value="true"/>&nbsp;&nbsp;&nbsp;
                                <spring:message code="no"/> <form:radiobutton path="depositLess" value="false"/></td>

                        </tr>
                        </tr>
                        <tr>
                            <td><spring:hasBindErrors name="hospital">  
                                    <div class="error">
                                        <form:errors path="*"/>
                                    </div>
                                </spring:hasBindErrors></td>
                        </tr>
                        <tr>
                            <td><input type="button" name="btnCancel" value="<spring:message code="button.Cancel"/>" onclick="location.href='../hospital/listHospital.htm'" /></td>   
                            <td><input type="submit" name="btnSubmit" value="<spring:message code="button.Update"/>" onclick="return yav.performCheck('form1', rules, 'inline');"/></td>

                        </tr>
                    </table>
                </fieldset>
            </div>
            <div style="width: 55%;  position: absolute; top:150px; right:10px; font:normal 12px/normal Arial;">
                <div id="map_canvas"></div><br/>
            </div>
        </form:form>
    </body>
</html>
